package com.gzl.demo.controller;

import com.gzl.demo.entity.Aaa;
import com.gzl.demo.service.AaaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/aaa")
public class AaaController {

    @Autowired
    private AaaService aaaService;

    @Autowired
    private JedisConnectionFactory jedisConnectionFactory;

    @PostMapping(value = "/test")
    public Aaa gzl() throws Exception {


            //aaaService.gzl();
        return aaaService.demo1();


       /* com.gzl.demo.entity.Aaa aaa = new com.gzl.demo.entity.Aaa();
        aaa.setDateTime(new Date());
        return aaaService.save(aaa);*/

       /* try (Jedis jedis = (Jedis) jedisConnectionFactory.getConnection().getNativeConnection()) {

            String setRet = jedis.set("aaa", "1", "NX", "EX", TimeUnit.SECONDS.toSeconds(60));
            return setRet != null;
        }catch (Exception e){
            e.printStackTrace();
        }
        return false;*/

    }

    private void bbb() {
        if (1 > 0) {
            return;
        } else {
            System.out.println("hahahha");
        }
    }


}
